#include"buddy.h"
#include "slab.h"
#include "stdio.h"

struct task_info{
    int pid;
    int run_count;
};

//buddy and slab init.
int main(void){

    zone_init();
    buddy_alloctor_init();
    printf("after init buddy status:\n");
    show_buddy_all_free_ares();
    
    // buddy_test();
    slab_init();
    struct kmem_cache* cachep =  kmem_cache_create("task_info",sizeof(struct task_info),0,0,0);

    show_slab_info();
    slab_test(cachep);

    printf("ready to destory kmem_cache. \n");
    kmem_cache_destory(cachep);
    show_slab_info();
    show_slab_node_info(kmem_cache);
    show_buddy_all_free_ares();     //由于free_limit的存在会保存 会有一些页没有被释放
    buddy_alloctor_free();
    return 0;
}